package com.sfac.modules.common.vo;


import lombok.Data;
import org.apache.commons.lang3.StringUtils;

@Data
public class Search {

    private int currentPage;
    private int pageSize;
    private String sort;
    private String direction;
    private String keyWord;


    public void init(){
        this.currentPage = this.currentPage == 0?1:this.currentPage;
        this.pageSize =this.pageSize == 0? 5:this.pageSize;
        this.sort= StringUtils.isBlank(this.sort)?"id":this.sort;
        this.direction = StringUtils.isBlank(this.direction)?"asc":this.direction;
    }



    public Search(int currentPage, int pageSize, String sort, String direction, String keyWord) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.sort = sort;
        this.direction = direction;
        this.keyWord = keyWord;
    }

    public Search() {
    }
}
